package cn.geoportal.benoserver.mapper;

import cn.geoportal.benoserver.entity.ShploadTask;
import cn.geoportal.benoserver.entity.vo.shpload.ShploadGet;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @Entity cn.geoportal.benoserver.entity.ShploadTask
 */
public interface ShploadTaskMapper extends BaseMapper<ShploadTask> {
    /**
     *
     * @param page
     * @param wrapper
     * @return
     */
    IPage<ShploadTask> queryShploadPage(Page<ShploadTask> page, @Param(Constants.WRAPPER) QueryWrapper<ShploadTask> wrapper);

    /**
     *
     * @param name
     * @param description
     * @param epsg
     * @return
     */
    @Select("INSERT INTO t_shpload_task(name, description, dbid, shpfile, epsg, status) values(#{name}, #{description}, #{dbid}, #{shpfile}, #{epsg},#{status} ) RETURNING id")
    @Options(flushCache = Options.FlushCachePolicy.TRUE)
    int addShploadTask(@Param("name") String name, @Param("description") String description, @Param("dbid") Integer dbid,
                       @Param("shpfile") String shpfile, @Param("epsg") String epsg, @Param("status") String status);

    /**
     *
     * @param id
     * @return
     */
    ShploadGet getShploadById(Integer id);
}




